<template>
    <van-tabbar v-model="active" @change="changeFn" route placeholder v-if="$route.meta.isshownav">
        <!-- placeholder  固定在底部时，是否在标签位置生成一个等高的占位元素 -->
        <van-tabbar-item icon="home-o" to="/home">home</van-tabbar-item>
        <van-tabbar-item icon="cart-o" to="/cart">cart</van-tabbar-item>
        <van-tabbar-item v-if="!userStore.islogined" icon="user-o" to="/login">login</van-tabbar-item>
        <van-tabbar-item v-else icon="user-o" to="/user">user</van-tabbar-item>
    </van-tabbar>
</template>
<script lang='ts' setup>
import { ref, type Ref } from 'vue';
import {useUserStore} from '@/stores/userStore'
const active:Ref<number>=ref(0)   
const changeFn=(index:number)=>{
    // console.log(index);
    active.value=index
}
const userStore=useUserStore()
// console.log('是否登录',userStore.islogined);

// const isshow=ref<boolean>(true)
// let isshow=computed(()=>{
//     return localStorage.getItem('token')?false:true
// })
// console.log(localStorage.getItem('token'));
// if(localStorage.getItem('token')){
//     isshow.value=false
// }

</script>
<style scoped>

</style>
